/*
 * @Author: boyyang
 * @Date: 2022-01-02 00:19:39
 * @LastEditTime: 2022-01-02 17:56:50
 * @LastEditors: boyyang
 * @Description: 路由
 * @FilePath: \boyyang\src\router\index.ts
 */

import type { App } from 'vue'
import { createRouter, createWebHashHistory } from "vue-router"
import { createRouterGuards } from './routerGuards'
import { constantRoutes } from './constantRoutes'

const router = createRouter({
    history: createWebHashHistory(),
    routes: constantRoutes
})

const setupRouter = (app: App<Element>) => {
    app.use(router)
    // 创建路由守卫 
    createRouterGuards(router)
}


export {
    setupRouter,
    router
}
